<template>
  <div class="main">
    <NavBar title="我的" />
    <div class="toper ub ub-ac">
      <div class="userDiv">
        <image src="../../static/user.png" class="userImg udb" mode="aspectFit" />
      </div>
      <div class="ub-f1 ub ub-ver" style="margin-left:10rpx">
        <div class="txt" style="font-size:32rpx;font-weight:bold">{{ userData.userName || '***' }}</div>
        <div class="txt" style="font-size:24rpx">{{ userData.orgName || '***' }}</div>
        <div class="txt" style="font-size:24rpx">额度：10000元(余2000元)</div>
      </div>
    </div>
    <div class="menus ub ub-ac ub-pj">
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/1.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">我的仓库</div>
      </div>
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/3.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">我的车辆</div>
      </div>
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/2.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">我的线路</div>
      </div>
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/4.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">我的销售</div>
      </div>
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/imgs')">
        <image src="../../static/assets/1.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">我的图片</div>
      </div>
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/2.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">记事本</div>
      </div>
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/3.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">我的拜访</div>
      </div>
      <div class="item ub-ver ub ub-ac ub-pc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/4.png" class="icon_menu" mode="aspectFit" />
        <div class="menuTit">我的销售</div>
      </div>
    </div>
    <div class="arrows plr20">
      <div class="item ub ub-ac bbc" @click.stop="toPage('/pages/user/psdupdate')">
        <image src="../../static/assets/6.png" class="icon_cell" mode="aspectFit" />
        <div class="ub-f1 itemTit">打印机设置</div>
        <image src="../../static/arrow-right.png" class="arrow-right" />
      </div>
      <div class="item ub ub-ac bbc" @click.stop="toPage('/pages/user/psdupdate')">
        <image src="../../static/assets/7.png" class="icon_cell" mode="aspectFit" />
        <div class="ub-f1 itemTit">修改密码</div>
        <image src="../../static/arrow-right.png" class="arrow-right" />
      </div>
      <div class="item ub ub-ac bbc" @click.stop="toPage('/pages/user/detail')">
        <image src="../../static/assets/7.png" class="icon_cell" mode="aspectFit" />
        <div class="ub-f1 itemTit">设置</div>
        <image src="../../static/arrow-right.png" class="arrow-right" />
      </div>
      <div class="item ub ub-ac bbc" @click.stop="logout">
        <image src="../../static/assets/7.png" class="icon_cell" mode="aspectFit" />
        <div class="ub-f1 itemTit">退出</div>
        <image src="../../static/arrow-right.png" class="arrow-right" />
      </div>
    </div>
  </div>
</template>
<script>
import service from '@/utils/http'
import constant from '@/utils/constant'
import { errDialog, loading, toPage } from '@/utils/util'
export default {
  data() {
    const token = uni.getStorageSync('Access-Token')
    return {
      storeId: uni.getStorageSync('storeId'),
      isLogin: !!token,
      paddingTop: 50,
      address: '',
      isAuth: false,
      userData: {},
      userId: '',
      toPage
    }
  },
  onLoad() {
    this.getData()
  },
  methods: {
    logout() {
      uni.showModal({
        title: '温馨提示',
        content: '确定要退出吗？',
        showCancel: true,
        success(res) {
          if (res.confirm) {
            service.post('/app/logout').then(res => {
              uni.reLaunch({ url: '/pages/user/login' })
            })
          } else if (res.cancel) {
            console.log('用户点击取消')
          }
        }
      })
    },
    getData() {
      service.post('/app/user/getLogonUser').then(res => {
        this.userData = res.data
      })
    }
  }
}
</script>
<style scoped>
.main {
  position: relative;
  width: 100%;
  height: 100%;
  background: #fff;
}
.main > div {
  position: relative;
  z-index: 1;
}
.toper {
  height: 160rpx;
  padding-bottom: 20rpx;
  position: relative;
  padding-left: 30rpx;
  background: #3387FF;
}
.toper .txt {
  color: #fff;
  font-size: 24rpx;
}
.userDiv {
  border: 1rpx #fff solid;
  width: 120rpx;
  height: 120rpx;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
  margin-right: 18rpx;
  position: relative;
}
.userImg {
  width: 120rpx;
  height: 120rpx;
}

.kefu{
  padding: 0;background: transparent;
}

.kefu::after {
  border: 0;
}

.headImg {
  width: 130rpx;
  height: 130rpx;
  border-radius: 100rpx;
  margin-right: 30rpx;
  background-color: #fff;
  border: 4rpx #fff solid;
}

.menus{width: 700rpx;background: #fff;margin: 20rpx auto; border-radius: 12rpx;box-shadow: 0 0rpx 10rpx 10rpx #f1f1f1; flex-wrap: wrap;}
.menus .item{width:175rpx;height: 150rpx;}

.arrows{margin-top:20rpx}

.arrows .item{background: #fff;height: 96rpx;}

.menuTit{
  margin-top: 8rpx;
  font-size: 26rpx;
}
.itemTit{font-size: 28rpx;text-align: left;}
.icon_menu{width: 64rpx;height: 64rpx;}
.icon_cell{width: 48rpx;height: 48rpx;margin-right:20rpx}
.loginTxt{font-size: 32rpx;position: relative; color: #eee;margin-left:10rpx;height: 100rpx;line-height: 100rpx;}
.btn {
  width: 670rpx;
  position: absolute;
  bottom: 40rpx;
  left: 40rpx;
  font-size: 30rpx;
  color: #fff;
  height: 88rpx;
  line-height: 88rpx;
  background: #3387FF;
}
.activeBtn{
  background-color: #5999E1;
}
</style>
